﻿using System;
using System.Data;
using System.Collections.Generic;
using SERP.DAO;
namespace SERP.Controllers{
public class WorkPositionsControllerBase : Controller{
	public WorkPositionsControllerBase()
		: base()
	{
	}
	private static WorkPositionsDAO _Service; 
	public static WorkPositionsDAO Service{
		get{
			if(_Service==null)
				_Service = new WorkPositionsDAO();
			return _Service;
		}
		set{
			_Service = value;
		}
	}
    //Copy data from data row in grid to object
    public WorkPositionsEntity MapDataRowToObject(DataRow row){
		WorkPositionsEntity o = new WorkPositionsEntity();
		 o.PosName=Convert.ToString(row["PosName"]);
		 o.Note=Convert.ToString(row["Note"]);
		 if(!row.IsNull("BinaryId"))
			o.BinaryId=(Int32)(row["BinaryId"]);
		 if(!row.IsNull("PositionId"))
			o.PositionId=(Int32)(row["PositionId"]);
		 if(!row.IsNull("PositionId"))
		    o.PositionId=(Int32)(row["PositionId"]);
		 return o;
    }
	//Copy data from object to data row in grid    
    public void MapObjectToDataRow(WorkPositionsEntity o,DataRow row){
		row["PosName"]=o.PosName;
		row["Note"]=o.Note;
		row["BinaryId"]=o.BinaryId;
		row["PositionId"]=o.PositionId;
		row["PositionId"]=o.PositionId;
    }
}
}
